package hibernate.method.interfaces;

import hibernate.model.Token;
import hibernate.model.User;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

public interface UserMethodsInterface {

	/* dodaje uzytkownika */
	public void add(SessionFactory sessionFactory, Session session,
			String username, String birthdate, String email,
			String type, String gender, String name, String surname,
			String phone, String password);

	/* usuwa uzytkownika */
	public void delete(SessionFactory sessionFactory, Session session, User u);

	/* wypisuje uzytkownikow danego typu */
	public List<User> list_by_type(SessionFactory sessionFactory,
			Session session, String type);
	

	/* sprawdza podany login i haslo */
	public List<User> username_password(SessionFactory sessionFactory,
			Session session, String username, String password);

	/* wypisuje wszystkie nazwy uzytkownikow */
	public List<User> list(SessionFactory sessionFactory, Session session);

	/* zwraca obiekt uzytkownika na podstawie jego numeru id */
	public User id_to_user(SessionFactory sessionFactory, Session session,
			int user_id);

	/* edytuje date urodzenia */
	public void edit_birthdate(SessionFactory sessionFactory, Session session,
			String birthdate, User u);

	/* edytuje adres email */
	public void edit_email(SessionFactory sessionFactory, Session session,
			String email, User u);

	/* zmienia plec uzytkownika */
	public void edit_gender(SessionFactory sessionFactory, Session session,
			String gender, User u);

	/* edytuje imie uzytkownika */
	public void edit_name(SessionFactory sessionFactory, Session session,
			String name, User u);

	/* edytuje nazwisko uzytkownika */
	public void edit_surname(SessionFactory sessionFactory, Session session,
			String surname, User u);

	/* edytuje numer telefonu */
	public void edit_phone(SessionFactory sessionFactory, Session session,
			String phone, User u);

	/* zmienia haslo */
	public void edit_password(SessionFactory sessionFactory, Session session,
			String password, User u);

	/* weryfikuje logowanie */
	public int sign_up_validation(SessionFactory sessionFactory,
			Session session, String username, String password);

	/* zwraca rekordy z podanym loginem */
	public List<User> is_user(SessionFactory sessionFactory, Session session,
			String username);

	/* zwraca wszystkie zarejestrowane emaile */
	public List<String> used_emails(SessionFactory sessionFactory,
			Session session, String type);

	/* zwraca wszystkie nicki z bazy */
	public List<String> used_usernames(SessionFactory sessionFactory,
			Session session);

	/* Sprawdza czy email istnieje juz w bazie */
	public boolean isEmailExist(SessionFactory sessionFactory, Session session,
			String email, String type);
	public boolean isUsernameExist(SessionFactory sessionFactory, Session session,
			String username);
	
	public String getUserType(SessionFactory sessionFactory, Session session, int user_id); 
	
	public int countClients(SessionFactory sessionFactory, Session session);
	
	public List<User> listLatestRegisteredUsers(SessionFactory sessionFactory, Session session);
	public String maxDateRegister (SessionFactory sessionFactory, Session session);
	
	
	public int countUsersByAgeRange (SessionFactory sessionFactory, Session session, int beginAge, int endAge);
	
	public void insertToken(SessionFactory sessionFactory, Session session, String token, String operation, int user_id, String email);
	
	public List<Token> findTokenByOperationAndUser (SessionFactory sessionFactory, Session session, String operation, int user_id);
	
	public void activateUser(SessionFactory sessionFactory, Session session, int user_id);
	

}
